var Benchmark = require('benchmark');
var suite = new Benchmark.Suite;
const logger2 = require('./v0.2.0');
const logger3 = require('./v0.3.0');
const newLogger = (require('./v0.4.0'));
const logger41 = (require('./v0.4.1')).init({flushInterval:500});
const logger52 = require('./v0.5.2').init({flushInterval:500});
const logger100 = require('./v1.0.0').init({flushInterval:500});
const NEW_LINE_SEPARATOR = require('os').EOL;

// process.stdout._handle.setBlocking(false);
suite
.add('v0.2.0',function() {
    logger2.debug('this is version 0.2.0');
})
.add('v0.3.0',function() {
    logger3.debug('this is version 0.3.0');
})
.add('v0.4.0',function() {
    newLogger.debug('this is version 0.4.0');
})
.add('v0.4.1',function() {
    logger41.debug('this is version 0.4.1');
})

.add('v0.4.1 async',function() {
    // logger41.init({flushInterval:500});
    logger41.debug('this is version 0.4.1(async mode)');
})
.add('v0.5.2 async',function() {
    // logger52.init({flushInterval:500});
    logger52.debug('this is version 0.5.2(async mode)');
})
.add('v1.0.0 async',function() {
    // logger100.init({flushInterval:500});
    logger100.debug('this is version 1.0.0(async mode)');
})
.on('cycle', function(event) {// add listeners
  process.stderr.write(String(event.target) + NEW_LINE_SEPARATOR);
})
.on('complete', function() {
    process.stderr.write('Fastest is ' + this.filter('fastest').map('name') + NEW_LINE_SEPARATOR);
})
// run async
.run({async:true});
